<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<!--引入css-->
<head >
    <title th:text="系统权限表">标题</title>
    <link th:replace="admin/include/head :: head">
    <link rel="stylesheet" th:href="@{/resources/bootstrap/css/bootstrap-treetable.css}">
</head>
<body>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <table id="sysPermissiontable"></table>
        </div>
    </div>
</section>

<!--引入js-->
<div th:replace="admin/include/footer :: foot"></div>
<script th:src="@{/resources/common/crud.js}"></script>
<script th:src="@{/resources/bootstrap/js/bootstrap-treetable.js}"></script>

</body>

<script type="text/javascript">
    $(function () {
        var columns = [
            /*{
                field: 'ck',
                checkbox: true,
                align:'center',
                valign:'middle'
            },*/
            {
                field: "name",
                title: "权限名称",
                align:'center',
                valign:'middle',
            },

            {
                field: "permission",
                title: "权限标识",
                align:'center',
                valign:'middle'
            },
            {
                field: "sort",
                title: "权限排序",
                align:'center',
                valign:'middle'
            },
            {
                field: 'createTime',
                title: '创建时间',
                align:'center',
                valign:'middle'
            }, {
                field: 'id',
                title: '操作',
                align:'center',
                valign:'middle',
                formatter: function (value, row, index) {
                    return ' <button id="btn_edit" type="button" class="btn btn-primary  btn-xs" onclick="poplayer(2,\'修改\',\'/admin/sysPermission/toForm?id='+value+'\')"><i class="fa fa-edit"></i> 修改</button> ' +
                            ' <button type="button" class="btn btn-danger  btn-xs" onclick="deletes(\'/admin/sysPermission/delete\',\'' + value + '\')"><i class="fa fa-trash-o"></i> 删除</button> ';
                }
            }
        ]
        var toolbar1 =
            '<div id="toolbar" class="btn-group">' +
            '<button id="btn_add" type="button" class="btn btn-info btn-xs" onclick="poplayer(2,\'新增\',\'/admin/sysPermission/toForm\')"><i class="fa fa-plus"></i> 新增 </button>' +
            ' </div>'
        $("#sysPermissiontable").bootstrapTreeTable({
            code: 'id',
            parentCode: 'parentId',
            type: 'get',
            url: '/admin/sysPermission/list',
            striped: false,
            expandColumn: '0',
            bordered: true,
            columns: columns,
            toolbar: toolbar1
        });
    })
</script>
</html>